/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package EventProcessor;

import java.awt.event.KeyEvent;

/**
 *
 * @author luc0
 */
public class KeyMapper {

    public KeyMapper() {
    }

    public int getKeyEventValueFromString(String button) {
        if(button==null){
            return 0;
        }
        button = button.toLowerCase();
        int returnValue = 0;
        if (button.equals("a")) {
            returnValue = KeyEvent.VK_A;
        } else if (button.equals("b")) {
            returnValue = KeyEvent.VK_B;
        } else if (button.equals("c")) {
            returnValue = KeyEvent.VK_C;
        } else if (button.equals("d")) {
            returnValue = KeyEvent.VK_D;
        } else if (button.equals("e")) {
            returnValue = KeyEvent.VK_E;
        } else if (button.equals("f")) {
            returnValue = KeyEvent.VK_F;
        } else if (button.equals("g")) {
            returnValue = KeyEvent.VK_G;
        } else if (button.equals("h")) {
            returnValue = KeyEvent.VK_H;
        } else if (button.equals("i")) {
            returnValue = KeyEvent.VK_I;
        } else if (button.equals("j")) {
            returnValue = KeyEvent.VK_J;
        } else if (button.equals("k")) {
            returnValue = KeyEvent.VK_K;
        } else if (button.equals("l")) {
            returnValue = KeyEvent.VK_L;
        } else if (button.equals("m")) {
            returnValue = KeyEvent.VK_M;
        } else if (button.equals("n")) {
            returnValue = KeyEvent.VK_N;
        } else if (button.equals("o")) {
            returnValue = KeyEvent.VK_O;
        } else if (button.equals("p")) {
            returnValue = KeyEvent.VK_P;
        } else if (button.equals("q")) {
            returnValue = KeyEvent.VK_Q;
        } else if (button.equals("r")) {
            returnValue = KeyEvent.VK_R;
        } else if (button.equals("s")) {
            returnValue = KeyEvent.VK_S;
        } else if (button.equals("t")) {
            returnValue = KeyEvent.VK_T;
        } else if (button.equals("u")) {
            returnValue = KeyEvent.VK_U;
        } else if (button.equals("v")) {
            returnValue = KeyEvent.VK_V;
        } else if (button.equals("w")) {
            returnValue = KeyEvent.VK_W;
        } else if (button.equals("x")) {
            returnValue = KeyEvent.VK_X;
        } else if (button.equals("y")) {
            returnValue = KeyEvent.VK_Y;
        } else if (button.equals("z")) {
            returnValue = KeyEvent.VK_Z;
        }else if (button.equals("down")) {
            returnValue = KeyEvent.VK_DOWN;
        }else if (button.equals("up")) {
            returnValue = KeyEvent.VK_UP;
        }else if (button.equals("left")) {
            returnValue = KeyEvent.VK_LEFT;
        }else if (button.equals("right")) {
            returnValue = KeyEvent.VK_RIGHT;
        }else if (button.equals(":")) {
            returnValue = KeyEvent.VK_COLON;
        }else if (button.equals(",")) {
            returnValue = KeyEvent.VK_COMMA;
        }else if (button.equals("=")) {
            returnValue = KeyEvent.VK_EQUALS;
        }else if (button.equals("!")) {
            returnValue = KeyEvent.VK_EXCLAMATION_MARK;
        }else if (button.equals("(")) {
            returnValue = KeyEvent.VK_LEFT_PARENTHESIS;
        }else if (button.equals(")")) {
            returnValue = KeyEvent.VK_RIGHT_PARENTHESIS;
        }else if (button.equals("-")) {
            returnValue = KeyEvent.VK_MINUS;
        }else if (button.equals("*")) {
            returnValue = KeyEvent.VK_MULTIPLY;
        }else if (button.equals("+")) {
            returnValue = KeyEvent.VK_PLUS;
        }else if (button.equals("\"")) {
            returnValue = KeyEvent.VK_QUOTE;
        }else if (button.equals(";")) {
            returnValue = KeyEvent.VK_SEMICOLON;
        }else if (button.equals("/")) {
            returnValue = KeyEvent.VK_SLASH;
        }else if (button.equals("_")) {
            returnValue = KeyEvent.VK_UNDERSCORE;
        }else if (button.equals("left click")) {
            returnValue = -1;
        }else if (button.equals("right click")) {
            returnValue = -2;
        } else if (button.equals("€")) {
            returnValue = KeyEvent.VK_EURO_SIGN;
        }else if (button.equals("0")) {
            returnValue = KeyEvent.VK_0;
        }else if (button.equals("1")) {
            returnValue = KeyEvent.VK_1;
        }else if (button.equals("2")) {
            returnValue = KeyEvent.VK_2;
        }else if (button.equals("3")) {
            returnValue = KeyEvent.VK_3;
        }else if (button.equals("4")) {
            returnValue = KeyEvent.VK_4;
        }else if (button.equals("5")) {
            returnValue = KeyEvent.VK_5;
        }else if (button.equals("6")) {
            returnValue = KeyEvent.VK_6;
        }else if (button.equals("7")) {
            returnValue = KeyEvent.VK_7;
        }else if (button.equals("8")) {
            returnValue = KeyEvent.VK_8;
        }else if (button.equals("9")) {
            returnValue = KeyEvent.VK_9;
        }else if (button.equals("ctrl")) {
            returnValue = KeyEvent.VK_CONTROL;
        }else if (button.equals("shift")) {
            returnValue = KeyEvent.VK_SHIFT;
        }else if (button.equals("space")) {
            returnValue = KeyEvent.VK_SPACE;
        }else if (button.equals("enter")) {
            returnValue = KeyEvent.VK_ENTER;
        }else if (button.equals("escape")) {
            returnValue = KeyEvent.VK_ESCAPE;
        }else if (button.equals("alt")) {
            returnValue = KeyEvent.VK_ALT;
        }

        return returnValue;
    }
}
